package org.jader.bolao.statistics.classificationtable;

import java.util.Set;

import org.jader.bolao.Game;
import org.jader.bolao.Team;
import org.jader.bolao.statistics.ClassificationTable;

public abstract class TeamRow implements Comparable<TeamRow> {

	private Team team = null;
	private ClassificationTable owner = null;
	
	protected TeamRow(ClassificationTable ct, Team t, Set<Game> games) {
		this.owner = ct;
		this.team = t;
		generateRowData(games);
	}
	
	public int getPosition() {
		return owner.getTeamPosition(this.team);
	}
	
	public Team team() {return this.team;}
	
	public abstract GameColumn getGameColumn(Game game);

	public abstract GameColumn getTotalColumn();
	
	public ClassificationTable classificationTable() {return this.owner;}

	protected abstract void generateRowData(Set<Game> games);

	@Override
	public abstract int compareTo(TeamRow arg0);
	
	public class GameColumn {
		private int sum = 0;
		
		public GameColumn(int sum) {
			this.sum = sum;
		}
		
		public int totalSum() {return this.sum;}
		
		@Override
		public String toString() {
			return Integer.toString(this.sum);}
	}
}
